#!/bin/bash

set -x

set -eo pipefail

# When the custom image is run as a S2I builder we allow for the user to
# provide their own plugins, themes and languages directories. We need to
# stash these away and they will be applied only when the final application
# image is run so that they can be applied to what is contained in the
# persistent volume.

mkdir -p /opt/app-root/downloads

mkdir -p /tmp/src/plugins
mkdir -p /tmp/src/themes
mkdir -p /tmp/src/languages
mkdir -p /tmp/src/configs

mv /tmp/src/plugins /opt/app-root/downloads/plugins
mv /tmp/src/themes /opt/app-root/downloads/themes
mv /tmp/src/languages /opt/app-root/downloads/languages
mv /tmp/src/configs /opt/app-root/downloads/configs

rm -rf /tmp/src
